package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    //根据菜品id查询对应的菜品id
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);
    //新增套餐
    @AutoFill(OperationType.INSERT)
    void insert(List<SetmealDish> setmealDishes);

    //分页查询
    Page<SetmealVO> select(SetmealPageQueryDTO setmealPageQueryDTO);

    //删除菜品关系中的套餐
    @Delete("delete from setmeal_dish where dish_id = #{id}")
    void delete(Long id);
    //查询套餐关联关系
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> selectById(Long id);

    /*//修改套餐关系表
    void update(List<SetmealDish> setmealDishes);*/
}
